// 一个loading组件, 在relation中上传过大附件时使用

import React, { useState, useRef, useImperativeHandle } from 'react';
import { intl } from '@/utils';
import { LoadPanel } from 'devextreme-react/load-panel';

export const LoadingBounced: React.FC<any> = React.forwardRef((props, ref) => {
  const [visible, setVisible] = useState<boolean>(false);

  useImperativeHandle(ref, () => ({
    show: () => {
      setVisible(true);
    },
    close: () => {
      setVisible(false);
    },
  }));

  return (
    <LoadPanel
      visible={visible}
      showIndicator={true}
      showPane={true}
      shading={true}
      shadingColor="rgba(0,0,0,0.4)"
    />
  );
});
